package com.daoeping.dao;

import com.daoeping.data.Bzn_answercomm;
import com.daoeping.data.Bzn_question;
import com.daoeping.data.Usr_user;

import java.util.List;
import org.hibernate.LockMode;
import org.hibernate.Query;
import static org.hibernate.criterion.Example.create;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class Bzn_answercommDAO extends AllDaoSupport {
	public List<Bzn_answercomm> findBzn_answercommList(Bzn_answercomm bzn_answercomm){
		return (List<Bzn_answercomm>) selectDataByHQL("from Bzn_answercomm anscomm where anscomm.usr_user.id ="+bzn_answercomm.getUsr_user().getId());
	}
	
	public boolean delBzn_answercommByQuestionId(Bzn_question bzn_question){
		return updateDataByHQL("delete from Bzn_answercomm anscomm where anscomm.bzn_answer.id in (select ans.id from Bzn_answer ans where ans.bzn_question.id = "+bzn_question.getId()+")");
	}
}